package demo

object demo {
  def main(args: Array[String]): Unit = {
    val i: Int = 5
    println(i)



    //利用隐式函数强转类型
    implicit def strToInt(str: String): Int = {
      return Integer.valueOf(str)
    }
    var str: String = "123"
    var num: Int = str

    //或者使用toXXX强转类型
    var str1 : Char = 123
    var num1 : String = str1.toString

    //对象向下转型
    var animal:Animal = new Animal()

    var dog:Dog = animal.asInstanceOf[Dog]


  }

  class Animal{}

  class Dog extends Animal {}
}
